home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Hardware / AV Tools / VUMeters / Sources / ARTA Includes / DSPConstants.h next >
Encoding:
Text File  |  1993-10-27  |  21.4 KB  |  384 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        DSPConstants.h
  3.  
  4.     Contains:    Constants for the Macintosh DSP API
  5.  
  6.     Copyright:    © 1990-1992 by Apple Computer, Inc., all rights reserved.
  7.  
  8. */
  9. //=========================================================================================
  10.  
  11. #ifndef __DSPConstants__
  12. #define __DSPConstants__
  13.  
  14. //==========================================================================================
  15. //                         DSP MODULE/SECTION DEFINTIONS
  16. //==========================================================================================
  17.  
  18. //------------------------------------------------------------------------------------------
  19. //     FIFOFlags
  20. //------------------------------------------------------------------------------------------
  21. #define kdspFIFOMaskAllMessages            0x00000000    // disable all messages                    
  22.                                                     // (p) priority of FIFO messages in descending order 
  23. #define kdspFIFOEnableOverUnderMessage    0x00000001    // (3) enable message when FIFO transfer causes an overrun or underrun                                                            
  24. #define kdspFIFOEnableFullEmptyMessage  0x00000002    // (2) enable message when FIFO goes full or empty                
  25. #define kdspFIFOEnableHighLowMessage    0x00000004    // (1) enable message when FIFO goes at least half full or half empty
  26. #define kdspFIFOEnableLinkMessage        0x00000008    // (4) enable message when FIFO's link is traversed                                
  27.  
  28. #define kdspFIFOOverUnderTaskInactive    0x00000010    // if task accessing FIFO causes either FIFO overrun or underrun then set task inactive                                                            
  29. #define kdspFIFOFullEmptyTaskInactive    0x00000020    // if task accessing FIFO causes either FIFO full    or empty    then set task inactive                                                                
  30.  
  31. //------------------------------------------------------------------------------------------
  32. //    ModuleFlags (Check out DSPConstantsPrivate.h to see all of the flags)
  33. //------------------------------------------------------------------------------------------
  34. #define kdspAutoCache                     0x00000000    // select the auto cache model                
  35. #define    kdspDemandCache                    0x00000001    // select the demand cache model            
  36. #define kdspOnChipSectionTable            0x00000004    // put the section table on-chip
  37. #define kdspOnChipStack                    0x00000020    // A stack of the specified size will be created on-chip
  38. #define kdspOffChipStack                0x00000040    // A stack of the specified size will be created off-chip
  39.  
  40. //------------------------------------------------------------------------------------------
  41. //     GPBFlags (see DSPConstantsPrivate.h for the complete list of flags)
  42. //------------------------------------------------------------------------------------------
  43. #define kdspLumpyModule                    0x00000000    // use bnEstimate
  44. #define kdspSmoothModule                0x00000001    // see DSPConstantsPrivate.h
  45.  
  46. //------------------------------------------------------------------------------------------
  47. //    SectionFlags (some of these flags are defined in the private file)
  48. //------------------------------------------------------------------------------------------
  49. // Costs the DSP one instruction to use the following flags:
  50. #define    kdspLeaveSection                0x00000000    // do not load or save this section            
  51. #define    kdspLoadSection                    0x00000001    // load this section                         
  52. #define    kdspSaveSection                    0x00000002    // save this section                        
  53. #define    kdspClearSection                0x00000004    // fill this section with zeroes            
  54. #define    kdspSaveOnContextSwitch            0x00000008    // save this section on context switch        
  55.  
  56. #define    kdspExternal                    0x00000000    // Never loaded on chip                        
  57. #define    kdspBankA                        0x00000020    // load in bank A if possible                
  58. #define    kdspBankB                        0x00000040    // load in bank B if possible                
  59. #define    kdspAnyBank            (kdspBankA | kdspBankB)    // load anywhere                            
  60. #define kdspStaticSection                0x00000080    // this section statically allocated before runtime                    
  61.  
  62. #define kdspFIFOSection                    0x00000100    // section is an FIFO buffer                
  63. #define kdspReservedSectionFlag0200        0x00000200    // reserved
  64. #define kdspReservedSectionFlag0400        0x00000400    // when loading convert from a FIFO
  65. #define kdspReservedSectionFlag0800        0x00000800    // when saving  convert to   a FIFO
  66.  
  67. #define    kdspReservedSectionFlag1000        0x00001000    // this is a HIHO Section        
  68. #define kdspReservedSectionFlag2000        0x00002000    // this flag bit will hold the kdspToggleSectionTable fkag from the module's flag 
  69. #define kdspReservedSectionFlag4000        0x00004000    // when loading convert from a HIHO
  70. #define kdspReservedSectionFlag8000        0x00008000    // when saving  convert to   a HIHO
  71.  
  72. // Costs the DSP two instructions to use the following flags:
  73. #define kdspNotIOBufferSection            0x00010000    // All cases other than below                
  74. #define    kdspInputBuffer                    0x00020000    // section is an input buffer                
  75. #define    kdspOutputBuffer                0x00040000    // section is an output buffer                
  76. #define kdspReservedSectionFlag80000    0x00080000    // section is an InterTask Buffer            
  77. #define    kdspScalableSection                0x00100000    // section size can be scaled                
  78. #define kdspReservedSectionFlag200000    0x00200000    // Reserved for use by the DSP Manager                    
  79. #define    kdspDSPUseOnly                    0x00400000    // only DSP should modify this memory        
  80.  
  81. //------------------------------------------------------------------------------------------
  82. //     SectionDataTypes
  83. //------------------------------------------------------------------------------------------
  84. #define    kdspNonData                        0x00000000    // data in section is beyond description    
  85. #define    kdsp3200Float                    0x00000001    // data is 3200 float format                
  86. #define    kdspIEEEFloat                    0x00000002    // data is in IEEE float format                
  87. #define    kdspInt32                        0x00000003    // data is 32bit integer                    
  88. #define    kdspInt1616                        0x00000004    // data is 16bit integer packed                
  89. #define    kdspInt8888                        0x00000005    // data is 8bit integer packed                
  90. #define    kdspmuLaw                        0x00000006    // data is muLaw format                        
  91. #define    kdspALaw                        0x00000007    // data is A law format                        
  92. #define    kdspAppSpecificData                0x0000FFFF    // data is application specific                
  93.  
  94. //==========================================================================================
  95. //                         DSP CLIENT DEFINTIONS
  96. //==========================================================================================
  97. //------------------------------------------------------------------------------------------
  98. //     constants used by a client to specify where to insert a task
  99. //------------------------------------------------------------------------------------------
  100. #define    kdspHeadInsert                    0x00000004        // insert at head of list                    
  101. #define    kdspTailInsert                    0x00000008        // insert tail of list                        
  102. #define    kdspBeforeInsert                0x00000010        // insert before reference link                
  103. #define    kdspAfterInsert                    0x00000020        // insert after reference link                
  104. #define kdspAnyPositionInsert            kdspHeadInsert    // caller does not care where it goes    
  105.  
  106. //------------------------------------------------------------------------------------------
  107. //    constants for messages received by client tasks
  108. //------------------------------------------------------------------------------------------
  109. #define kdspBIOPinChangedState            0x62696f70    //  'biop'    bio pin has changed state
  110.  
  111. #define kdspFIFOMessage                    0x66000000    //    'f'        prefix used for FIFO messages
  112. #define kdspFIFOLinkMessage                0x666c6e6b    //  'flnk'    the FIFO's link was traversed
  113. #define kdspFIFOOverrunMessage            0x666f7672    //    'fovr'    the FIFO's buffer filled  before the FIFO write completed                                            
  114. #define kdspFIFOUnderrunMessage            0x66756e64    //    'fund'    the FIFO's buffer emptied before the FIFO read  completed
  115. #define kdspFIFOFullMessage                0x6666756c    //    'fful'    the FIFO's buffer is exactly full                                        
  116. #define kdspFIFOEmptyMessage            0x66656d70    //    'femp'    the FIFO's buffer is exactly empty                                        
  117. #define kdspFIFOHighMessage                0x66686967    //    'fhig'    the FIFO's buffer is at least half full  but not exactly full                                                
  118. #define kdspFIFOLowMessage                0x666c6f77    //    'flow'    the FIFO's buffer is at least half empty but not exactly empty                                                
  119. #define kdspFIFOPrimeMessage            0x66707269    //    'fpri'    application specific    
  120.  
  121. #define kdspExceptionMessage            0x78000000    //  'x'        prefix used for dsp exception messages
  122. #define kdspExceptionReset                0x78727374    //    'xrst'                                    
  123. #define kdspExceptionBusError            0x78627573    //    'xbus'                            
  124. #define kdspExceptionIllegalOpcode        0x78696c6c    //    'xill'    
  125. #define kdspExceptionReservedOne        0x78727631    //    'xrv1'        
  126. #define kdspExceptionAddressError        0x78616472    //    'xadr'    
  127. #define kdspExceptionDAUOverUnderflow    0x78646175    //    'xdau'    
  128. #define kdspExceptionNotANumber            0x786e616e    //    'xnan'    
  129. #define kdspExceptionReservedTwo        0x78727632    //    'xrv2'        
  130. #define kdspExceptionExternalIntZero    0x78657830    //    'xex0'        
  131. #define kdspExceptionTimer                0x7874696d    //    'xtim'    
  132. #define kdspExceptionReservedThree        0x78727633    //    'xrv3'    
  133. #define kdspExceptionSIOInputBufFull    0x78736962    //    'xsib'        
  134. #define kdspExceptionSIOOutputBufEmpty    0x78736f62    //    'xsob'    
  135. #define kdspExceptionSIODMAInputFrame    0x78736966    //    'xsif'
  136. #define kdspExceptionSIODMAOutputFrame    0x78736f66    //    'xsof'    
  137. #define kdspExceptionExternalIntOne        0x78657831    //    'xex1'    
  138.  
  139. #define kdspExceptionRuntimeError        0x78657272    //    'xerr'    
  140.  
  141. #define kdspGPBMessage                    0x67000000    //    'g'     prefix used for GPB messages                        
  142. #define kdspGPBTaskActive                0x67616374    //    'gact'    the task is   active                        
  143. #define kdspGPBTaskInactive                0x67696e61    //    'gina'    the task is inactive                            
  144. #define kdspGPBFrameOverrun                0x676f7672    //    'govr'    this task was involved in a frame ovverrun and is now inactive                            
  145. #define kdspGPBFrameSkip                0x67736b70    //    'gskp'    this task has skipped one or more frames due to a frame ovverun                            
  146.  
  147. //------------------------------------------------------------------------------------------
  148. // read/write permission constants for clients
  149. //------------------------------------------------------------------------------------------
  150. #define kdspWritePermission                0x0001
  151. #define kdspReadPermission                0x0002
  152. #define kdspReadWritePermission         (kdspWritePermission|kdspReadPermission)
  153.  
  154. //------------------------------------------------------------------------------------------
  155. // constants for indexed devices
  156. //------------------------------------------------------------------------------------------
  157.  
  158. // CPU processor types
  159. #define kdsp3210                        '3210'
  160.  
  161. // General constants
  162. #define kdspDeviceFeatures                'feat'
  163.  
  164. // CPU constants
  165. #define kdspDeviceName                    'dnam'
  166. #define kdspDeviceICON                    'dicn'
  167. #define kdspSlotNumber                    'dslt'
  168. #define kdspProcessorType                'ptyp'
  169. #define kdspPhaseRegister                'phas'
  170. #define kdspPhaseRollover                'phro'
  171. #define    kdspFrameRate                    'fmrt'
  172.  
  173. // IO constants
  174. #define kdspIODeviceName                'ionm'
  175. #define kdspIODeviceICON                'ioic'
  176.  
  177. // Selectors for BIO devices
  178. #define    kdspBIOPinState                    'bios'
  179. #define    kdspBIOPinDirection                'biod'
  180. #define    kdspBIOInterruptMask            'biom'
  181. #define    kdspBIOInterruptHandler            'bioh'
  182.  
  183. // Selectors for SIO devices
  184. #define    kdspSampleRate                    'smrt'
  185. #define    kdspSampleFormat                'smsz'
  186.  
  187. //  Use option's current index
  188. #define    kdspCurrentIndex                    -1
  189.  
  190. // CPU device feature bits
  191. #define kdspMotherBoard                        0
  192. #define kdspCanBeSlaveCPUDevice                1
  193. #define kdspCanOnlyAccessDSPZone            2
  194.  
  195. //  IO device types
  196. #define kdspSIOTypeDevice                     0
  197. #define    kdspBIOTypeDevice                     1
  198.  
  199. // SIO device feature bits
  200. #define kdspStdSoundCompatible                0
  201. #define kdspRegisterDSPOutputSifter            1
  202. #define kdspInstallDSPInputDriver            2
  203. #define kdspInputDriverOptionsDialogBox        3
  204.  
  205. // BIO Pin constants
  206. #define kdspBIOPinZero                    (0)
  207. #define kdspBIOPinOne                    (1)
  208. #define kdspBIOPinTwo                    (2)
  209. #define kdspBIOPinThree                    (3)
  210. #define kdspBIOPinFour                    (4)
  211. #define kdspBIOPinFive                    (5)
  212. #define kdspBIOPinSix                    (6)
  213. #define kdspBIOPinSeven                    (7)
  214.  
  215. #define kdspBIOConfigurePinForInput        (0)
  216. #define    kdspBIOConfigurePinForOutput    (1)
  217.  
  218. #define kdspBIOPinKeepCurrentState        (0)
  219. #define    kdspBIOPinSetToZero                (1)
  220. #define    kdspBIOPinSetToOne                (2)
  221. #define    kdspBIOPinToggleCurrentState    (3)
  222.  
  223. //------------------------------------------------------------------------------------------
  224. // constants for DSP API functions
  225. //------------------------------------------------------------------------------------------
  226. #define kevtMessageToHost                (17)
  227. #define kevtCacheSection                (22)
  228. #define kevtCopyFIFO                    (23)
  229. #define    kevtGetSectionSize                (43)
  230. #define kevtGPBSetUseActual                (44)
  231. #define kevtGPBExpectedCycles            (45)
  232. #define kevtGPBElapsedCycles            (46)
  233. #define kevtSemaphoreSet                (47)
  234. #define kevtSemaphoreClear                (48)
  235. #define kevtGPBChangeMode                (49)
  236. #define    kevtSetSkipCount                (50)
  237. #define kevtSetTaskInactive                (51)
  238. #define kevtBlockMove                    (53)
  239. #define    kevtNumRealTimeFrames            (113)    
  240.  
  241. //==========================================================================================
  242. //    constants for errors returned by Macintosh DSP API
  243. //==========================================================================================
  244.  
  245. //------------------------------------------------------------------------------------------
  246. // Misc Errors
  247. //  Error numbers allocated to the Real-Time Manager:  -2600 -> -2674   (JDB 7/14)
  248. //     The next available error code number is -2669
  249. //    N.B. If you add an error, also add it to the DSPErrorStrings.r file.
  250. //------------------------------------------------------------------------------------------
  251. #define kdspUnimplemented                (-2626)     // This feature is not done                
  252. #define kdspParamErr                    (-2638)        // bad parameter passed in                
  253.  
  254. //------------------------------------------------------------------------------------------
  255. // DSPFIFO Errors
  256. //------------------------------------------------------------------------------------------
  257. #define kdspNotAFIFOSection                (-2634)        // The section is not a FIFO
  258. #define kdspNoMessageInterrupt            (-2636)        // no message passing without a vector
  259. #define kdspFIFOInUseByDSP                (-2653)        // This FIFO is currently being accessed by the DSP
  260. #define kdspTaskMustBeInActive            (-2654)        // Can only Dipose of InActive structures
  261. #define kdspNotFirstFIFO                (-2655)        // The FIFO must be the first fifo in the link to wrap it
  262.  
  263. //------------------------------------------------------------------------------------------
  264. // DSPList Errors
  265. //------------------------------------------------------------------------------------------
  266. #define    kdspPositionIllegalErr            (-2600)        // Illegal DSPPosition type                
  267. #define    kdspPositionBusyErr                (-2601)        // DSPPosition already occupied            
  268. #define kdspInvalidReferenceErr            (-2602)        // illegal insertion request            
  269. #define kdspNonExistantReferenceErr        (-2603)        // reference element does not exist        
  270. #define kdspNonExistantElementErr        (-2604)        // deletion element not found            
  271.  
  272. //------------------------------------------------------------------------------------------
  273. // DSPMemory Errors
  274. //------------------------------------------------------------------------------------------
  275. #define kdspMemFullErr                    (-2605)        // heap full, allocation failed            
  276. #define kdspAddressNotInZone            (-2606)        // address is not in a zone                
  277. #define kdspNilAddress                    (-2617)        // Trying to dispose of nil                
  278. #define kdspContainingNilAddress        (-2618)        // Trying to dispose of (nil, nil)        
  279. #define    kdspInvalidZoneSize                (-2619)        // Heap Size must be factor of four        
  280. #define    kdspInvalidZoneBase                (-2620)        // Heap base must be long word aligned    
  281.  
  282. //------------------------------------------------------------------------------------------
  283. // DSPClient Errors
  284. //------------------------------------------------------------------------------------------
  285. #define kdspDeviceNotFound                 (-2607)        // no device matching given name        
  286. #define kdspInvalidIndexErr                (-2608)        // no device (or whatever) matching index given        
  287. #define kdspDeviceHasActiveClients        (-2609)        // can't sign out device with clients    
  288. #define kdspInvalidPermission            (-2622)        // invalid permission for operation        
  289. #define kdspWritePermissionDenied        (-2623)        // client already exist w/ write perm    
  290. #define kdspClientNameInvalid            (-2624)        // client name must be [1……31] bytes    
  291. #define kdspInvalidOptionSelector        (-2625)        // options selector not recognized        
  292. #define    kdspInvalidIODeviceType         (-2641)        // invalid io device type, index out of range
  293. #define kdspInvalidClientICON            (-2651)        // An invalid ICON was passed in
  294. #define kdspDeviceCantBeSlave            (-2662)        // The specified cpu device cannot be a slave
  295.  
  296. //------------------------------------------------------------------------------------------
  297. // Resource Loader Errors
  298. //------------------------------------------------------------------------------------------
  299. #define kdspModuleNotFound                (-2610)        // the module does not exist            
  300. #define kdspModuleUncompatibleRate        (-2611)        // incompatible frame or sample rate    
  301. #define kdspUnknownDSPFResourceVersion    (-2613)        // DSPF resource not recognized            
  302. #define kdspUnknownDSPSectionTag        (-2614)        // DSPF resource not recognized    
  303. #define kdspZeroGPB                        (-2648)        // The Module has GPB set to zero.
  304. #define kdspTwoStacks                    (-2665)        // Can not have both an on-chip and an off-chip stack
  305.  
  306. //------------------------------------------------------------------------------------------
  307. // DSPStorage Errors
  308. //------------------------------------------------------------------------------------------
  309. #define kdspStorageNotFound                (-2629)        // theAmount and Location do no exist    
  310. #define kdspNotEnoughOnChipMemory        (-2630)        // not enough on-chip memory to allocate
  311.  
  312. //------------------------------------------------------------------------------------------
  313. // DSPAllocation Errors
  314. //------------------------------------------------------------------------------------------
  315. #define kdspCouldNotAllocate            (-2612)        // Could not allocate the module        
  316. #define kdspMoreThanOneModule            (-2621)        // can allocate only one module for now    
  317. #define kdspSectionAlreadyConnected        (-2627)        // One of the Sections has already been    
  318.                                                     // connected. (i.e. FIFO Sections)            
  319. #define kdspSectionsDoNotMatch            (-2628)        // the sections which are being         
  320.                                                     // connected either do not have the     
  321.                                                     // same size or the same type or
  322.                                                     // they are both input or both output
  323. #define kdspSectionsNotInSameTask        (-2640)        // The sections that are being connected
  324.                                                     // are not in the same task
  325. #define kdspSectionNotFound                (-2631)        // Could not find the specified section    
  326. #define kdspBothFIFOsAllocated            (-2632)        // Both FIFO sections have already been    
  327.                                                     // attached to FIFOs                    
  328. #define kdspHadToUseOffChipMemory        (-2633)        // at least 1 section which was supposed    
  329.                                                     // to be on-chip was set up off-chip.    
  330.                                                     // The module will still run, but not    
  331.                                                     // as quickly                            
  332. #define kdspAlreadyAllocated            (-2635)        // You can not make a mew ITB or         
  333.                                                     // connect sections if the task has        
  334.                                                     // already been allocated.                
  335. #define kdspTooManyITBs                    (-2637)        // You can not have more than             
  336.                                                     // MAX_MAP_SECTIONS ITBs                
  337. #define kdspInvalidModuleAddress        (-2646)        // Passed in a nil module address
  338. #define kdspAIAOMustLoadOrSave            (-2649)        // When connecting a FIFO to an AIAO, the
  339.                                                     // AIAO must move data or the connection
  340.                                                     // will not work.
  341. #define kdspFIFOsNotConnected            (-2650)        // You can not insert a task if all of the
  342.                                                     // FIFOs are not connected to other FIFOs.
  343. #define kdspNotAllocated                (-2652)        // You must insert the task before you can
  344.                                                     // call DSPGetSectionData
  345. #define kdspTaskNotInstalled            (-2666)        // You can not get the available on-chip memory
  346.                                                     // until after the task is installed
  347.                                                     
  348. //------------------------------------------------------------------------------------------
  349. // DSPTask Errors
  350. //------------------------------------------------------------------------------------------
  351. #define kdspTaskRefNumAlreadyAllocated    (-2615)        // trying to reuse used DSPTaskRefNum     
  352. #define kdspNilMessageActionProc        (-2639)        // passed in nil where MessageActionProc required
  353. #define kdspInvalidCPUDevicePtr            (-2642)        // passed in nil for the DSPCPUDeviceParamBlkPtr
  354. #define kdspInvalidTaskRefNumPtr        (-2643)        // passed in nil for the DSPTaskRefNumPtr
  355. #define kdspInvalidTaskAddress            (-2644)        // passed in nil for the DSPTaskAddressPtr
  356. #define kdspInvalidTaskRefNum            (-2645)        // passed in nil for the DSPTaskRefNum
  357. #define kdspInvalidTaskName                (-2647)        // length of name must be > 0 and < 31
  358. #define kdspNoMasterSlaveRelationship    (-2656)        // tasks to be synchronized must be on one
  359.                                                     // DSP or on DSPs that have master-slave relationship
  360. #define kdspAllTasksMustBeRealTime        (-2657)        // tasks to be synchronized that are on different
  361.                                                     // DSPs must all be in the real-time task list
  362. #define kdspNotEnoughTime                (-2658)        // didn’t have enough time to successfully synchronize
  363.                                                     // all the taks
  364. #define kdspChangingState                (-2659)        // task is in the process of going (in)active
  365. #define kdspAlreadyActive                (-2660)        // task is in already active
  366. #define kdspAlreadyInactive                (-2661)        // task is in already inactive
  367. #define kdspTimeOutErr                    (-2667)        // timed out trying to set the task inactive (probably a stupid time
  368.                                                     //  share task that never calls return(RV)!)  <SM10> JDB
  369. #define kdspFrameOverrunRecoveryErr        (-2668)        // DSP is in frame overrun recovery, can’t install now.
  370.                                                     
  371.  
  372. //------------------------------------------------------------------------------------------
  373. // DSPGPB Errors
  374. //------------------------------------------------------------------------------------------
  375. #define kdspNotEnoughGPB                (-2616)        // not enough real time for allocation    
  376.  
  377. //------------------------------------------------------------------------------------------
  378. // DSP Address Fixup Errors
  379. //------------------------------------------------------------------------------------------
  380. #define    kdspOnChipPatchup                (-2663)        // auto-init using address already on chip
  381. #define kdspBadRelocationType            (-2664)        // internal assert - unrecognized relocation type from linker
  382.  
  383. #endif
  384.